package cn.edu.ren.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;

/**
 * @PackageName: cn.edu.ren.pojo
 * @ClassName: User
 * @Description:
 * @author: RZS
 * @date: 2021/5/19  20:22
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Slf4j
public class User {
    @NotNull(message = "id不能为空")
    private Long id;
    @NotEmpty(message = "姓名不能为空字符")
    @Length(min = 2, max = 4, message = "正常的名字长度范围为2-4个字符")
    private String name;
    @NotNull(message = "年龄不能为空")
    @Min(value = 0, message = "年龄不能小于0岁")
    @Max(value = 120, message = "年龄不能大于120岁")
    private Integer age;
    @NotEmpty
    @Email(regexp = "/^[_.0-9a-z-a-z-] @([0-9a-z][0-9a-z-] .) [a-z]{2,4}$/", message="邮件格式不正确")
    private String email;
}
